/*
 *  Copyright 2010 Ancora Research Group.
 * 
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 * 
 *       http://www.apache.org/licenses/LICENSE-2.0
 * 
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */

package org.ancora.IntermediateRepresentation;

import java.util.EnumMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author Joao Bispo
 */
public abstract class Transformation {

  //public abstract List<Operation> transform(List<Operation> operations);
  public abstract void transform(List<Operation> operations);
    //void transform(List<Operation> operations);

   public Transformation() {
      stats = new EnumMap<OperationType, Integer>(OperationType.class);
   }



   public Map<OperationType, Integer> getStats() {
      return stats;
   }

   protected void updateStats(Operation operation) {
      // Add operation to table
      Integer value = stats.get((OperationType) operation.getType());
      if (value == null) {
         value = 0;
      }
      value++;
      stats.put((OperationType) operation.getType(), value);
   }

   /**
    * INSTANCE VARIABLES
    */
    private Map<OperationType, Integer> stats;


}
